Writing a Drawing Engine
This section shows how to write a new drawing engine and add it to the QuickDraw 3D Acceleration Layer.
You need to read this section only if you are developing custom 3D acceleration hardware or software. If you simply want to create a draw context and draw into it using low-level drawing functions, see
"Using QuickDraw 3D RAVE"
.
To develop a new drawing engine and add it to the QuickDraw 3D Acceleration Layer, you need to perform these seven steps:
-
Write methods for the public functions pointed to by the fields of a draw context structure (for example,
setInt
). These methods are described in detail in the section
"Public Draw Context Methods"
.
-
Write methods for the
TQADrawPrivateNew
and
TQADrawPrivateDelete
function prototypes. These functions are called internally by the
QADrawContextNew
and
QADrawContextDelete
functions, respectively. You use these methods to allocate and release any private data (such as state variables) maintained by your drawing engine. These methods are described in detail in the section
"Private Draw Context Methods"
.
-
Write methods for any texture and bitmap functions supported by your drawing engine (
TQATextureNew
,
TQATextureDetach
,
TQATextureDelete
,
TQABitmapNew
,
TQABitmapDetach
, and
TQABitmapDelete
). These functions are called by their public counterparts (for example,
QABitmapNew
). These methods are described in detail in the section
"Texture and Bitmap Methods"
.
-
Write a method to handle the
QAEngineGestalt
function when your drawing engine is the target engine. This method is described in detail on
[link]
.
-
Write a method to handle the
QAEngineCheckDevice
function when your drawing engine is the target engine. QuickDraw 3D RAVE calls this method to determine which devices your drawing engine supports. This method is described in detail on
[link]
.
-
Write a method for the
TQAEngineGetMethod
function prototype. QuickDraw 3D RAVE calls this method to get some of your engine's methods during engine registration. This method is described in detail on
[link]
.
-
Build your code as a shared library. The initialization routine of the shared library should register your drawing engine with QuickDraw 3D RAVE by calling the
QARegisterEngine
function.
The following sections describe some of these steps in more detail. The section
"Supporting OpenGL Hardware"
contains information that is useful if you are implementing a drawing engine to support hardware that is based on an OpenGL rasterization model.
© 1997 Apple Computer, Inc.Previous | QD3D Book | Overview | Chapter Contents | Next